package o;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.ColorDrawable;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.OpenForumMessageAction;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.OpenForumMessageAction.MsgCallBack;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.OpenForumMessageAction.RestoreCallBack;
import com.huawei.appgallery.assistantdock.buoydock.bean.GetGameBuoyEntryInfoResp$PlayerInfo;
import com.huawei.appgallery.forum.message.api.IMessageHomeProtocol;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appmarket.service.common.protocol.AppActivityProtocol;
import com.huawei.appmarket.service.common.protocol.AppActivityProtocol.Request;
import com.huawei.fastengine.fastview.download.utils.PackageUtils;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import com.huawei.hwid.core.constants.HwAccountConstants;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import o.beo.f;
import o.dky.j;

public class bgx extends bgz implements OnClickListener, OnTouchListener {
    private ImageView ʻ;
    private ImageView ʼ;
    private ImageView ʼॱ;
    private TextView ʽ;
    private fae ʽॱ;
    private FrameLayout ʾ;
    private c ʿ;
    private String ˈ;
    private List<bfo> ˉ = new ArrayList(8);
    private boolean ˊ = false;
    private d ˊˊ;
    private String ˊˋ;
    private LinearLayout ˊॱ;
    private View ˊᐝ;
    private boolean ˋ = false;
    private GetGameBuoyEntryInfoResp$PlayerInfo ˋˊ;
    private boolean ˋˋ = false;
    private LinearLayout ˋॱ;
    private fkg ˋᐝ;
    private boolean ˎ = false;
    private boolean ˎˎ = false;
    private boolean ˏ = false;
    private LinearLayout ˏॱ;
    private LinearLayout ͺ;
    private boolean ॱ = false;
    private LinearLayout ॱˊ;
    private View ॱˋ;
    private TextView ॱˎ;
    private LinearLayout ॱॱ;
    private Context ᐝ;
    private PopupWindow ᐝॱ;

    class c extends Handler {
        final /* synthetic */ bgx ˏ;

        public c(bgx o_bgx, Looper looper) {
            this.ˏ = o_bgx;
            super(looper);
        }

        public void handleMessage(Message message) {
            if (message == null) {
                Logger.ˎ("BuoyHeadSegment", "Message is empty");
                return;
            }
            switch (message.what) {
                case 0:
                    ˋ();
                    return;
                case 1:
                    ˏ();
                    return;
                case 3:
                    ˊ();
                    return;
                case 4:
                    ˏ(message);
                    return;
                default:
                    return;
            }
        }

        private void ˏ(Message message) {
            if (message != null && (message.obj instanceof String)) {
                String str = (String) message.obj;
                if (TextUtils.isEmpty(str)) {
                    this.ˏ.ॱˎ.setVisibility(4);
                } else if (this.ˏ.ˎ) {
                    this.ˏ.ॱˎ.setVisibility(0);
                    this.ˏ.ॱˎ.setText(str);
                } else {
                    this.ˏ.ॱˎ.setVisibility(4);
                }
            }
        }

        private void ˋ() {
            Logger.ˎ("BuoyHeadSegment", "isLoginSuccessful:" + UserSession.getInstance().isLoginSuccessful());
            CharSequence userName = UserSession.getInstance().getUserName();
            if (UserSession.getInstance().isLoginSuccessful()) {
                this.ˏ.ʽ.setText(userName);
            } else {
                this.ˏ.ʽ.setText(f.ʼˋ);
            }
        }

        private void ˏ() {
            String headUrl = UserSession.getInstance().getHeadUrl();
            if (dof.ॱ(headUrl)) {
                this.ˏ.ʻ.setImageResource(beo$d.ᐧ);
                if (Logger.ˎ()) {
                    Logger.ˏ("BuoyHeadSegment", "Head Pic Url is null");
                }
                this.ˏ.ˊˋ = null;
            } else if (!headUrl.equals(this.ˏ.ˊˋ)) {
                equ.ˊ(this.ˏ.ʻ, headUrl, "head_default_icon");
                this.ˏ.ˊˋ = headUrl;
            } else if (Logger.ˎ()) {
                Logger.ˏ("BuoyHeadSegment", "same url , no need refresh");
            }
        }

        private void ˊ() {
            if (this.ˏ.ˋˊ == null || dof.ˋ(this.ˏ.ˋˊ.ˏ()) || !UserSession.getInstance().isLoginSuccessful()) {
                this.ˏ.ʼ.setVisibility(4);
            } else {
                eqx.ˎ(this.ˏ.ʼ, this.ˏ.ˋˊ.ˏ());
                this.ˏ.ʼ.setVisibility(0);
            }
            this.ˏ.ॱॱ.setVisibility(8);
            this.ˏ.ˊॱ.setVisibility(8);
            this.ˏ.ॱˊ.setVisibility(8);
            this.ˏ.ˋॱ.setVisibility(8);
            this.ˏ.ͺ.setVisibility(8);
            this.ˏ.ˏॱ.setVisibility(8);
            this.ˏ.ॱˎ.setVisibility(8);
            this.ˏ.ˎ = false;
            this.ˏ.ˋ = false;
            this.ˏ.ˏ = false;
            if (this.ˏ.ˉ != null && !this.ˏ.ˉ.isEmpty()) {
                int i = 0;
                for (bfo ˏ : this.ˏ.ˉ) {
                    i = ˏ(ˏ) + i;
                }
                ˋ(i);
            }
        }

        private int ˏ(bfo o_bfo) {
            String ˎ = o_bfo.ˎ();
            boolean z = true;
            switch (ˎ.hashCode()) {
                case -1703019473:
                    if (ˎ.equals("buoy_gss|forum_msg_v2")) {
                        z = true;
                        break;
                    }
                    break;
                case -1321762212:
                    if (ˎ.equals("buoy_gss|feedback")) {
                        z = true;
                        break;
                    }
                    break;
                case -709638973:
                    if (ˎ.equals("buoy_gss|change_user")) {
                        z = false;
                        break;
                    }
                    break;
                case 1135905225:
                    if (ˎ.equals("buoy_gss|app_assistant")) {
                        z = true;
                        break;
                    }
                    break;
                case 1372729196:
                    if (ˎ.equals("buoy_gss|forum_msg")) {
                        z = true;
                        break;
                    }
                    break;
            }
            switch (z) {
                case false:
                    this.ˏ.ॱ = true;
                    return 1;
                case true:
                    this.ˏ.ˊ = true;
                    return 1;
                case true:
                case true:
                    if (bfz.ˊ().ॱ(null)) {
                        this.ˏ.ˋᐝ();
                    } else if (this.ˏ.ˋˋ) {
                        this.ˏ.ˈ = ˎ(o_bfo.ˏ());
                        this.ˏ.ˋˋ = false;
                    }
                    this.ˏ.ˎ = true;
                    return 1;
                case true:
                    if (cep.ˋ(this.ˏ.ᐝ, "com.huawei.gameassistant")) {
                        this.ˏ.ˋ = true;
                        if (!this.ˏ.ˌ()) {
                            return 1;
                        }
                        this.ˏ.ˏ = true;
                        return 2;
                    }
                    break;
            }
            return 0;
        }

        private String ˎ(int i) {
            if (i <= 0) {
                return "";
            }
            return i >= 100 ? "99+" : String.valueOf(i);
        }

        private void ˋ(int i) {
            if (i > ॱ()) {
                this.ˏ.ˎ();
                return;
            }
            if (this.ˏ.ˎ) {
                this.ˏ.ॱॱ.setVisibility(0);
                this.ˏ.ʼ();
            }
            if (this.ˏ.ॱ) {
                this.ˏ.ˊॱ.setVisibility(0);
            }
            if (this.ˏ.ˋ) {
                this.ˏ.ˋॱ.setVisibility(0);
            }
            if (this.ˏ.ˏ) {
                this.ˏ.ͺ.setVisibility(0);
            }
            if (this.ˏ.ˊ) {
                this.ˏ.ॱˊ.setVisibility(0);
            }
        }

        private int ॱ() {
            if (this.ˏ.ᐝ.getResources().getConfiguration().orientation == 1) {
                return 2;
            }
            return 3;
        }
    }

    class d extends SafeBroadcastReceiver {
        final /* synthetic */ bgx ˋ;

        private d(bgx o_bgx) {
            this.ˋ = o_bgx;
        }

        public void onReceiveMsg(Context context, Intent intent) {
            String action = intent.getAction();
            if (Logger.ˎ()) {
                Logger.ˏ("BuoyHeadSegment", "ChangeHeadPicReceiver  action= " + action);
            }
            if (o.epx.d.ˎ.equals(action) && this.ˋ.ʿ != null) {
                this.ˋ.ˏॱ();
            }
        }
    }

    private void ˎ() {
        if (ˏ()) {
            this.ˏॱ.setVisibility(0);
        }
        if (this.ˎ) {
            this.ॱॱ.setVisibility(0);
            ʼ();
        }
    }

    private boolean ˏ() {
        if (this.ˋ || this.ˏ || this.ˊ || this.ॱ) {
            return true;
        }
        return false;
    }

    private void ʼ() {
        if (!TextUtils.isEmpty(this.ˈ)) {
            this.ॱˎ.setText(this.ˈ);
            this.ॱˎ.setVisibility(0);
        }
    }

    public void ॱ(@Nullable Bundle bundle) {
        super.ॱ(bundle);
        this.ᐝ = ContentManager.getInstant().getContext().getApplicationContext();
        this.ʽॱ = fam.ॱ().ˏ();
        ʻ();
        ᐝ();
    }

    public View ˋॱ() {
        View inflate = LayoutInflater.from(ContentManager.getInstant().getContext().getApplicationContext()).inflate(beo$j.ʽ, null);
        this.ʻ = (ImageView) inflate.findViewById(beo$e.ˊˊ);
        this.ʾ = (FrameLayout) inflate.findViewById(beo$e.ꜞ);
        this.ʼ = (ImageView) inflate.findViewById(beo$e.ˎˎ);
        this.ʽ = (TextView) inflate.findViewById(beo$e.ˋˊ);
        this.ˏॱ = (LinearLayout) inflate.findViewById(beo$e.ˉ);
        this.ॱˋ = inflate.findViewById(beo$e.ʼॱ);
        this.ॱॱ = (LinearLayout) inflate.findViewById(beo$e.ʻॱ);
        this.ॱˎ = (TextView) inflate.findViewById(beo$e.ॱˎ);
        this.ʼॱ = (ImageView) inflate.findViewById(beo$e.ॱˋ);
        this.ॱˊ = (LinearLayout) inflate.findViewById(beo$e.ͺ);
        this.ˋॱ = (LinearLayout) inflate.findViewById(beo$e.ˋॱ);
        this.ͺ = (LinearLayout) inflate.findViewById(beo$e.ᐝॱ);
        this.ˊॱ = (LinearLayout) inflate.findViewById(beo$e.ˍ);
        this.ʽ.setOnClickListener(this);
        this.ʽ.setOnTouchListener(this);
        this.ʾ.setOnClickListener(this);
        this.ʾ.setOnTouchListener(this);
        this.ॱॱ.setOnClickListener(this);
        this.ॱˊ.setOnClickListener(this);
        this.ˋॱ.setOnClickListener(this);
        this.ͺ.setOnClickListener(this);
        this.ˊॱ.setOnClickListener(this);
        this.ˏॱ.setOnClickListener(this);
        this.ˋˋ = true;
        ॱ();
        this.ˊᐝ = inflate;
        return inflate;
    }

    public void ॱ() {
        ॱॱ();
        ˏॱ();
        ॱˎ();
    }

    private void ʻ() {
        this.ʿ = new c(this, Looper.getMainLooper());
    }

    private void ᐝ() {
        this.ˊˊ = new d();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(o.epx.d.ˎ);
        ll.ˏ(this.ᐝ).ˏ(this.ˊˊ, intentFilter);
    }

    private void ʽ() {
        ll.ˏ(this.ᐝ).ˋ(this.ˊˊ);
    }

    private void ॱॱ() {
        this.ʿ.sendMessage(this.ʿ.obtainMessage(0));
    }

    private void ˏॱ() {
        this.ʿ.sendMessage(this.ʿ.obtainMessage(1));
    }

    private void ॱˎ() {
        if (this.ʽॱ != null) {
            GameInfo gameInfo = this.ʽॱ.getGameInfo();
            if (gameInfo != null) {
                ezo ˋ = ezs.ˏ().ˋ(gameInfo);
                if (ˋ != null) {
                    this.ˋˊ = ˋ.ॱ();
                    this.ˉ = ˋ.ˎ();
                } else {
                    this.ˋˊ = null;
                    this.ˉ = null;
                    if (Logger.ˎ()) {
                        Logger.ˏ("BuoyHeadSegment", "entryInfo is null");
                    }
                }
            } else if (Logger.ˎ()) {
                Logger.ˏ("BuoyHeadSegment", "invalid gameInfo");
            }
        } else if (Logger.ˎ()) {
            Logger.ˏ("BuoyHeadSegment", " buoyBridge is null");
        }
        this.ʿ.sendMessage(this.ʿ.obtainMessage(3));
    }

    private void ॱᐝ() {
        if (!this.ˎˎ) {
            ((bvn) fho.ˏ().ˋ("Message").ॱ(bvn.class)).ˊ(String.valueOf(2)).ˋ(fjt.ˋ(), new fke<HashMap<String, String>>(this) {
                final /* synthetic */ bgx ˎ;

                {
                    this.ˎ = r1;
                }

                public void ˎ(fkg o_fkg) {
                    Logger.ˎ("BuoyHeadSegment", "getTotalUnReadMsg disposable");
                    this.ˎ.ˋᐝ = o_fkg;
                }

                public void ॱ(HashMap<String, String> hashMap) {
                    if (hashMap != null && !hashMap.isEmpty()) {
                        String ˎ = ((bus) fho.ˏ().ˋ("Forum").ॱ(bus.class)).ˎ();
                        String str = (String) hashMap.get(ˎ);
                        Logger.ˎ("BuoyHeadSegment", "getTotalUnReadMsg unReadMsgCount:" + str + ",domainId:" + ˎ);
                        if (str != null && !str.equals(this.ˎ.ˈ)) {
                            Message message = new Message();
                            message.what = 4;
                            message.obj = str;
                            this.ˎ.ʿ.sendMessage(message);
                            this.ˎ.ˈ = str;
                        }
                    }
                }

                public void ˊ(Exception exception) {
                    Logger.ˋ("BuoyHeadSegment", "getTotalUnReadMsg onFailure");
                }

                public void ॱ() {
                    Logger.ˋ("BuoyHeadSegment", "getTotalUnReadMsg onComplete");
                }
            });
            this.ˎˎ = true;
        }
    }

    private void ʻॱ() {
        if (this.ˋᐝ != null) {
            this.ˋᐝ.ˋ();
            this.ˎˎ = false;
        }
    }

    public boolean onTouch(View view, MotionEvent motionEvent) {
        int id = view.getId();
        if (id == beo$e.ꜞ) {
            if (motionEvent == null) {
                return false;
            }
            ˊ(motionEvent);
            return this.ʾ.onTouchEvent(motionEvent);
        } else if (id != beo$e.ˋˊ || motionEvent == null) {
            return false;
        } else {
            ˊ(motionEvent);
            return this.ʽ.onTouchEvent(motionEvent);
        }
    }

    private void ˊ(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0 || 2 == motionEvent.getAction()) {
            this.ʻ.setAlpha(0.5f);
            this.ʽ.setAlpha(0.5f);
            return;
        }
        this.ʻ.setAlpha(1.0f);
        this.ʽ.setAlpha(1.0f);
    }

    public void onClick(View view) {
        int id = view.getId();
        if (id == beo$e.ꜞ || id == beo$e.ˋˊ) {
            if (UserSession.getInstance().isLoginSuccessful()) {
                ʿ();
            } else if (doo.ˊ(this.ᐝ)) {
                bfs.ˋ().ॱ(this.ᐝ);
            } else {
                ezn.ˊ().ˊ(this.ᐝ.getResources().getString(j.ॱʼ));
            }
        } else if (id == beo$e.ʻॱ) {
            ᐝॱ();
        } else if (id == beo$e.ˋॱ) {
            ˊᐝ();
        } else if (id == beo$e.ᐝॱ) {
            ˊˋ();
        } else if (id == beo$e.ͺ) {
            ʼॱ();
        } else if (id == beo$e.ˍ) {
            ʽॱ();
        } else if (id == beo$e.ˉ) {
            ˋˊ();
        }
    }

    private void ᐝॱ() {
        Logger.ˎ("BuoyHeadSegment", "click buoy forum msg button");
        Intent intent;
        if (ॱˋ()) {
            intent = new Intent(this.ᐝ, TransferActivity.class);
            intent.setAction(OpenForumMessageAction.ACTION_OPEN_FORUM_MESSAGE);
            OpenForumMessageAction.registerRestoreCallback(new RestoreCallBack(this) {
                final /* synthetic */ bgx ˏ;

                {
                    this.ˏ = r1;
                }

                public void onRestoreGetOnlineVersionFail() {
                    this.ˏ.ˏ(this.ˏ.ᐝ);
                }
            });
            fam.ॱ().ˎ(this.ᐝ, TransferActivity.class, intent, true);
        } else if (!bfz.ˊ().ॱ(null)) {
            ˏ(this.ᐝ);
        } else if (bgf.ˊ().ˋ(this.ᐝ, OpenForumMessageAction.REPORTBI_FORUMMSG_URI)) {
            intent = new Intent(this.ᐝ, TransferActivity.class);
            intent.setAction(OpenForumMessageAction.ACTION_OPEN_FORUM_MESSAGE);
            OpenForumMessageAction.registerCall(new MsgCallBack(this) {
                final /* synthetic */ bgx ˋ;

                {
                    this.ˋ = r1;
                }

                public void onGetMsg() {
                    this.ˋ.ˋᐝ();
                }
            });
            fam.ॱ().ˎ(this.ᐝ, TransferActivity.class, intent, true);
        }
    }

    private void ˏ(Context context) {
        String str = "message_home_activity";
        fjb ˎ = fho.ˏ().ˋ("Message").ˎ(str);
        IMessageHomeProtocol iMessageHomeProtocol = (IMessageHomeProtocol) ˎ.ˊ();
        iMessageHomeProtocol.setSourceType(2);
        iMessageHomeProtocol.setDomainId(((bus) fho.ˏ().ˋ("Forum").ॱ(bus.class)).ˎ());
        fam.ॱ().ॱ(context, cjl.ˋ(str), ˎ, true);
        ॱᐝ();
    }

    private boolean ॱˋ() {
        if (eqp.ᐝ() && bfz.ˊ().ˋ() && erz.ˎ(ContentManager.getInstant().getContext(), PackageUtils.HWGAMEBOX_PACKAGE_NAME) <= 100100300) {
            return true;
        }
        return false;
    }

    private void ʼॱ() {
        if (!UserSession.getInstance().isLoginSuccessful()) {
            bfs.ˋ().ॱ(this.ᐝ);
        } else if (this.ʽॱ == null || this.ʽॱ.getGameInfo() == null) {
            Logger.e("BuoyHeadSegment", "buoyBridge is null, feedBackClick failed");
        } else {
            cjm ˊ = dft.ˏ().ˊ(this.ʽॱ.getGameInfo().getAppId());
            ˊ.ॱ(this.ᐝ).setFlags(HwAccountConstants.FLAG_TRANSLUCENT_STATUS);
            fam.ॱ().ॱ(this.ᐝ, cjl.ˋ("feedback.new.activity"), ˊ);
        }
    }

    private void ʿ() {
        cjo appActivityProtocol = new AppActivityProtocol();
        appActivityProtocol.ॱ(new Request());
        appActivityProtocol.ˋ().ˋ("customColumn.personcenter");
        cjm o_cjm = new cjm("market.activity", appActivityProtocol);
        o_cjm.ॱ(this.ᐝ).setFlags(HwAccountConstants.FLAG_TRANSLUCENT_STATUS);
        fam.ॱ().ॱ(this.ᐝ, cjl.ˋ("market.activity"), o_cjm);
        bgi.ˋ().ˏ("GS0010003_" + UserSession.getInstance().getUserId());
        if (dgr.ˋ().ॱ("buoy_head")) {
            LinkedHashMap linkedHashMap = new LinkedHashMap(2);
            linkedHashMap.put("start_type", "buoy_head");
            dgh.ˋ("action_start_by_type", linkedHashMap);
            cfw.ˎ(new dgt("buoy_head"), new dgo("BuoyHeadSegment"));
        }
    }

    private void ʽॱ() {
        if (this.ʽॱ == null) {
            if (Logger.ˎ()) {
                Logger.ˏ("BuoyHeadSegment", "buoyBridge is null");
            }
        } else if (this.ʽॱ.getRequestParams() == null || !this.ʽॱ.getRequestParams().ˏ()) {
            ezv.ॱ().ॱ(true);
            bgi.ˋ().ˏ("GS0010004_" + UserSession.getInstance().getUserId());
        } else {
            ezv.ॱ().ˏ();
        }
    }

    private void ˊᐝ() {
        ced.ˎ(this.ᐝ, "com.huawei.gameassistant", "");
    }

    private void ˊˋ() {
        if (this.ᐝ != null) {
            try {
                Intent intent = new Intent("com.huawei.iconnect.action.SHOW_DEVICE");
                intent.setPackage("com.huawei.gameassistant");
                intent.putExtra("START_TYPE", 0);
                intent.putExtra("START_FROM", "BUOY");
                if (!(this.ᐝ instanceof Activity)) {
                    intent.addFlags(268435456);
                }
                this.ᐝ.startActivity(intent);
            } catch (Exception e) {
                Logger.e("BuoyHeadSegment", "open game space exception");
            }
        }
    }

    private void ˋˊ() {
        View ˋˋ = ˋˋ();
        this.ᐝॱ = new PopupWindow(ˋˋ, -2, -2, true);
        ˋˋ.measure(0, 0);
        if (VERSION.SDK_INT < 23) {
            this.ᐝॱ.setOutsideTouchable(true);
            this.ᐝॱ.setBackgroundDrawable(new ColorDrawable(fo.ˋ(this.ᐝ, beo$b.ˊ)));
        }
        int measuredWidth = (this.ॱˋ.getMeasuredWidth() - ˋˋ.getMeasuredWidth()) - epv.ˋ(this.ᐝ, 16);
        int[] iArr = new int[2];
        this.ˏॱ.getLocationInWindow(iArr);
        int[] iArr2 = new int[2];
        this.ʾ.getLocationInWindow(iArr2);
        if (iArr[0] < iArr2[0]) {
            measuredWidth = epv.ˋ(this.ᐝ, 16);
        }
        this.ᐝॱ.showAsDropDown(this.ॱˋ, measuredWidth, 0);
    }

    private View ˋˋ() {
        View inflate = LayoutInflater.from(this.ᐝ).inflate(beo$j.ॱˊ, null);
        OnClickListener anonymousClass3 = new OnClickListener(this) {
            final /* synthetic */ bgx ˊ;

            {
                this.ˊ = r1;
            }

            public void onClick(View view) {
                if (view.getId() == beo$e.ॱᐝ) {
                    this.ˊ.ʼॱ();
                } else if (view.getId() == beo$e.ˋˋ) {
                    this.ˊ.ʽॱ();
                } else if (view.getId() == beo$e.ॱˊ) {
                    this.ˊ.ˊᐝ();
                } else if (view.getId() == beo$e.ˈ) {
                    this.ˊ.ˊˋ();
                }
                if (this.ˊ.ᐝॱ != null) {
                    this.ˊ.ᐝॱ.dismiss();
                }
            }
        };
        if (this.ˊ) {
            View findViewById = inflate.findViewById(beo$e.ॱᐝ);
            findViewById.setVisibility(0);
            findViewById.setOnClickListener(anonymousClass3);
        }
        if (this.ॱ) {
            findViewById = inflate.findViewById(beo$e.ˋˋ);
            findViewById.setVisibility(0);
            findViewById.setOnClickListener(anonymousClass3);
        }
        if (this.ˏ) {
            View findViewById2 = inflate.findViewById(beo$e.ˈ);
            TextView textView = (TextView) inflate.findViewById(beo$e.ʾ);
            if (!eqp.ᐝ()) {
                textView.setText(f.ˏॱ);
            }
            findViewById2.setVisibility(0);
            findViewById2.setOnClickListener(anonymousClass3);
        }
        if (this.ˋ) {
            findViewById = inflate.findViewById(beo$e.ॱˊ);
            findViewById.setVisibility(0);
            findViewById.setOnClickListener(anonymousClass3);
        }
        return inflate;
    }

    private String ॱ(int i) {
        if (i <= 0) {
            return "";
        }
        return i >= 100 ? "99+" : String.valueOf(i);
    }

    public void onResume() {
        super.onResume();
        ॱ();
    }

    public void onStop() {
        super.onStop();
        if (this.ᐝॱ != null) {
            this.ᐝॱ.dismiss();
        }
    }

    public void onDestroy() {
        super.onDestroy();
        ʽ();
        ʻॱ();
    }

    private boolean ˌ() {
        if (erz.ˎ(this.ᐝ, "com.huawei.gameassistant") >= 1000000203 && !bka.ॱ("ro.config.togglekey", false)) {
            return true;
        }
        return false;
    }

    private void ˋᐝ() {
        if (this.ʽॱ != null) {
            GameInfo gameInfo = this.ʽॱ.getGameInfo();
            if (gameInfo != null) {
                ezo ˋ = ezs.ˏ().ˋ(gameInfo);
                if (ˋ != null) {
                    bfz.ˊ().ˏ(ˋ, new bgc(this) {
                        final /* synthetic */ bgx ˋ;

                        {
                            this.ˋ = r1;
                        }

                        public void ˎ(bge o_bge) {
                            this.ˋ.ˏ(o_bge);
                        }
                    });
                }
            }
        }
    }

    private void ˏ(bge o_bge) {
        if (o_bge == null) {
            this.ʼॱ.setVisibility(8);
            this.ॱˎ.setVisibility(8);
        } else if (o_bge.ˏ() > 0) {
            this.ʼॱ.setVisibility(8);
            this.ॱˎ.setVisibility(0);
            String ॱ = ॱ(o_bge.ˏ());
            if (!ॱ.equals(this.ˈ)) {
                Message message = new Message();
                message.what = 4;
                message.obj = String.valueOf(o_bge.ˏ());
                this.ʿ.sendMessage(message);
                this.ˈ = ॱ;
            }
        } else {
            this.ˈ = "";
            if (o_bge.ˊ()) {
                this.ʼॱ.setVisibility(0);
                this.ॱˎ.setVisibility(8);
                return;
            }
            this.ʼॱ.setVisibility(8);
            this.ॱˎ.setVisibility(8);
        }
    }
}
